<template>
  <div class="chart-main-footer" style="height:300px">
    <el-card class="card">
      <div class="card-header">
        <span>热门流程排行榜 Top 10</span>
        <i class="el-icon-warning-outline"></i>
      </div>
      <div class="card-footer">
        <template v-for="(item, index) in hotShopData">
          <p :key="index" class="flex" :class="{ numberOne: index == 0 }">
            <span>
              <i class="circle">{{ index + 1 }}</i>
              {{ item.goodsTypename }}
            </span>
            <span>{{ item.amount }}</span>
          </p>
        </template>
      </div>
    </el-card>
    <el-card class="card">
      <div class="card-header">
        <span>处理工单人员排行榜</span>
        <i class="el-icon-warning-outline"></i>
      </div>
      <div class="card-footer">
        <template v-for="(item, index) in turnoverLeaderboardData">
          <p :key="index" class="flex" :class="{ numberOne: index == 0 }">
            <span>
              <i class="circle">{{ index + 1 }}</i>
              {{ item.people }}
            </span>
            <span>
              {{ item.amount }}
            </span>
          </p>
        </template>
      </div>
    </el-card>
    <el-card class="card">
      <div class="card-header">
        <span>工单处理耗时排行榜</span>
        <i class="el-icon-warning-outline"></i>
      </div>
      <div class="card-footer">
        <p style="font-size:14px"></p>
        <p class="likes">
          <i class="el-icon-star-off red"></i>
        </p>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      hotShopData: [
        {
          goodsTypename: " 申请数据库",
          amount: 21,
        },
        {
          goodsTypename: " 测试",
          amount: 11,
        },
        {
          goodsTypename: " 故障工单",
          amount: 10,
        },
        {
          goodsTypename: " 请假",
          amount: 6,
        },
        {
          goodsTypename: " 问题反馈",
          amount: 3,
        },
      ],
      turnoverLeaderboardData: [
        {
          people: "admin",
          amount: 11,
        },
      ],
      likeGoodsData: {},
    };
  },
  created() {
     this.init();
  },
  methods: {
    init() {
      this.isShow = true;
      setTimeout(() => {
        this.isShow = false;
      }, 2000);

      this.$axios
        .get("/nces/ncesOlders", {
          params: {
            adminName: this.$store.state.user.username,
          },
        })
        .then((res) => {
          console.log(res);
          for (const item of  this.turnoverLeaderboardData) {
             item.amount = res.data.result.adminOlders;
          }
         
        })
        .catch((e) => console.log(e));
    },
  },
};
</script>

<style scoped>
.chart-main-footer {
  width: 99%;
  height: 150px;
  margin: 10px auto 0;
  display: flex;
  justify-content: space-between;
}
.card {
  width: 32%;
  height: 100%;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.5;
  padding-bottom: 5px;
  border-bottom: 1px solid rgb(192, 190, 190);
}
.card-footer {
  width: 100%;
  font-size: 1rem;
  line-height: 1.5;
  font-family: "华文新魏", "Times New Roman", Times, serif;
}
.flex {
  display: flex;
  justify-content: space-between;
}

.circle {
  display: inline-block;
  width: 19px;
  height: 19px;
  border-radius: 100%;
  background-color: rgb(163, 159, 159);
  color: aliceblue;
  text-align: center;
  margin-right: 4px;
}
p.numberOne {
  font-weight: 800;
  color: red;
  font-size: 1.2rem;
}
.likes {
  float: right;
  line-height: 1.5;
  font-size: 1.2rem;
}
.red {
  color: red;
}
</style>
